package com.zqxq.lottery.cms.controller;

import com.zqxq.common.constant.Result;
import com.zqxq.lottery.cms.feign.LotteryServerFeignClient;
import com.zqxq.lottery.entity.bo.order.UserOrderBO;
import com.zqxq.lottery.entity.bo.sys.AddSysActivityBO;
import com.zqxq.lottery.entity.bo.sys.SysActivityBO;
import com.zqxq.lottery.entity.bo.sys.SysCouponBO;
import com.zqxq.lottery.entity.po.sys.SysCouponPO;
import com.zqxq.lottery.entity.vo.order.UserOrderVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;
@Api(value = "活动管理",tags = "活动管理")
@RestController
@Slf4j
@RequestMapping(value = "/activity", produces = "application/json")
public class ActivityController {

    @Autowired
    private LotteryServerFeignClient lotteryServerFeignClient;

    @ApiOperation(value = "创建活动", notes="创建活动")
    @PostMapping("/saveSysActivity")
    public Result saveSysActivity(AddSysActivityBO bo){
        return lotteryServerFeignClient.saveSysActivity(bo);
    }
    @ApiOperation(value = "删除活动", notes="删除活动")
    @PostMapping("/deleteSysActivity")
    public Result deleteSysActivity(String activityId){
        return lotteryServerFeignClient.deleteSysActivity(activityId);
    }
    @ApiOperation(value = "查询所有活动", notes="查询所有活动")
    @PostMapping("/querySysActivity")
    public Result querySysActivity(@ApiParam(value = "页码",required = true) @RequestParam(defaultValue = "1") String pageNo,
                                   @ApiParam(value = "每页大小",required = true) @RequestParam(defaultValue = "10") String pageSize){
        Map<String,Object> paramMap = new HashMap<>();
        paramMap.put("pageNo",pageNo);
        paramMap.put("pageSize",pageSize);
        return lotteryServerFeignClient.querySysActivity(paramMap);
    }
    @ApiOperation(value = "创建活动优惠券", notes="创建活动优惠券询")
    @PostMapping("/saveSysCoupon")
    public Result saveSysCoupon(SysCouponBO bo){
        return lotteryServerFeignClient.saveSysCoupon(bo);
    }
    @ApiOperation(value = "删除活动优惠券", notes="删除活动优惠券")
    @PostMapping("/deleteSysCoupon")
    public Result deleteSysCoupon(String couponId){
        return lotteryServerFeignClient.deleteSysCoupon(couponId);
    }
    @ApiOperation(value = "查询所有活动优惠券", notes="查询所有活动优惠券")
    @PostMapping("/querySysCoupon")
    public Result querySysCoupon(@ApiParam(value = "页码",required = true) @RequestParam(defaultValue = "1") String pageNo,
                                 @ApiParam(value = "每页大小",required = true) @RequestParam(defaultValue = "10") String pageSize,
                                 @ApiParam(value = "活动id",required = false) String activityId){
        Map<String,Object> paramMap = new HashMap<>();
        paramMap.put("pageNo",pageNo);
        paramMap.put("pageSize",pageSize);
        paramMap.put("activityId",activityId);
        return lotteryServerFeignClient.querySysCoupon(paramMap);
    }

}
